<template>
  <div class="HotSaleCard">
    <el-card>
      <el-form :model="cardForm" :rules="rules" label-width="100px" label-position="left">
        <el-col :span="6" style="margin-bottom: 22px">
          <sku-img v-model="cardForm.url" />
        </el-col>
        <el-col :span="18">
          <el-form-item prop="name" label="标题" style="margin-top: 10px">
            <el-col :span="22">
              <el-input v-model="cardForm.name" placeholder="请输入标题" maxlength="4" />
            </el-col>
          </el-form-item>
        </el-col>
      </el-form>
    </el-card>
  </div>
</template>

<script>
import SkuImg from '@/components/SkuImg'

export default {
  name: 'HotSaleCard',
  components: { SkuImg },
  props: {
    cardForm: {
      type: Object,
      default: null
    },
    index: {
      type: Number,
      required: true
    }
  },
  data() {
    return {
      id: null,
      rules: {
        name: [{ required: true, message: '请输入标题', trigger: 'blur' }]
      }
    }
  },
  methods: {
    getData() {
      const count = this.index + 1
      if (!this.cardForm.url) {
        return this.$message.error('第' + count + '个卖点图片未上传')
      } else {
        return this.cardForm
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.HotSaleCard {
  ::v-deep .avatar {
    width: 60px;
    height: 60px;
  }
  ::v-deep .avatar-uploader-icon {
    width: 60px;
    height: 60px;
    line-height: 60px;
  }
}
</style>
